package com.edu.atams.controller;

import com.edu.atams.common.dto.DashboardInfoDto;
import com.edu.atams.common.lang.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author gfj
 * @Date 2021/10/14 19:36
 * @description Dashboard
 */


@RestController
@RequestMapping("/dashboard")
public class DashboardController  extends BaseController{

    @GetMapping("/info")
    public Result info(){
        DashboardInfoDto dashboardInfoDto = new DashboardInfoDto();
        dashboardInfoDto.setStudentNum(studentService.getAllNum());
        dashboardInfoDto.setTeacherNum(teacherService.getAllNum());
        dashboardInfoDto.setClassNum(classService.getAllNum());
        dashboardInfoDto.setSubjectNum(subjectService.getAllNum());
        return Result.succ(dashboardInfoDto);
    }


    @GetMapping("/yearAllStudent")
    public Result getYearAllStudent(){
        return Result.succ(gradeService.getYearAllStudent());
    }

    @GetMapping("/getSexNum")
    public Result getSexNum(){
        return Result.succ(studentService.getSexNum());
    }
}
